<?php
/**
*
* @author Blackpawn blackpawn666@hotmail.com - http://blackpawnsarchives.net
* @co_author GameCharmer admin@gamecharmer.com - http://gaming.gamecharmer.com
* @package Age of Dragons Mod :: ( Game Console Required )
* @version $Id: questlist.php 1.1.1 12-26-2009 Blackpawn
* @copyright (c) 2009 Blackpawns Archives
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('AOD'))
{
	exit;
}
	// Build Quest List
	$total_quests = count_quests();
	
	$sql = "SELECT *
	FROM " . AOD_QUESTS_TABLE . " 
	WHERE quest_approved = 1 
	AND quest_level_req <= $kingdom_level 
	ORDER BY id ASC";
	$result = $db->sql_query_limit($sql, $quests_per_page, $start);
				
	while ($row = $db->sql_fetchrow($result))
	{
		$requirements = null;
		$rewards = null;
	
		$qid = $row['id'];
		$quest_name = $row['quest_name'];
		$quest_descript = $row['quest_descript'];
		$quest_img_path = $row['quest_img_path'];
		$quest_chance = $row['quest_chance'];
		
		
		// Check for level requirements
		$quest_level_req = $row['quest_level_req'];
		if($quest_level_req > 0)
		{
			$requirements .= sprintF($user->lang['LEVEL_REQUIREMENT'],number_format($quest_level_req));
		}	
	
		// Check for networth requirements
		$quest_net_req = $row['quest_net_req'];
		if($quest_net_req > 0)
		{
			$requirements .= sprintF($user->lang['NET_REQUIREMENT'],number_format($quest_net_req));
		}	

		// Check for population requirements
		$quest_villagers_req = $row['quest_villagers_req'];
		if($quest_villagers_req > 0)
		{
			$requirements .= sprintF($user->lang['VILLAGER_REQUIREMENT'],number_format($quest_villagers_req));
		}	

		$quest_spies_req = $row['quest_spies_req'];
		if($quest_spies_req > 0)
		{
			$requirements.=sprintF($user->lang['SPIES_REQUIREMENT'],number_format($quest_spies_req));
		}
		
		$quest_soldiers_req = $row['quest_soldiers_req'];
		if($quest_soldiers_req > 0)
		{
			$requirements .= sprintF($user->lang['SOLDIERS_REQUIREMENT'],number_format($quest_soldiers_req));
		}
		
		$quest_macemen_req = $row['quest_macemen_req'];
		if($quest_macemen_req > 0)
		{
			$requirements .= sprintF($user->lang['MACEMEN_REQUIREMENT'],number_format($quest_macemen_req));
		}
		
		$quest_axemen_req = $row['quest_axemen_req'];
		if($quest_axemen_req > 0)
		{
			$requirements .= sprintF($user->lang['AXEMEN_REQUIREMENT'],number_format($quest_axemen_req));
		}
		
		$quest_spearmen_req = $row['quest_spearmen_req'];
		if($quest_spearmen_req > 0)
		{
			$requirements .= sprintF($user->lang['SPEARMEN_REQUIREMENT'],number_format($quest_spearmen_req));
		}
		
		$quest_swordsmen_req = $row['quest_swordsmen_req'];
		if($quest_swordsmen_req > 0)
		{
			$requirements .= sprintF($user->lang['SWORDSMEN_REQUIREMENT'],number_format($quest_swordsmen_req));
		}
		
		$quest_legionnaires_req = $row['quest_legionnaires_req'];
		if($quest_legionnaires_req > 0)
		{
			$requirements .= sprintF($user->lang['LEGIONNARIES_REQUIREMENT'],number_format($quest_legionnaires_req));
		}
		
		$quest_knights_req = $row['quest_knights_req'];
		if($quest_knights_req > 0)
		{
			$requirements .= sprintF($user->lang['KNIGHTS_REQUIREMENT'],number_format($quest_knights_req));
		}
		
		$quest_slingers_req = $row['quest_slingers_req'];
		if($quest_slingers_req > 0)
		{
			$requirements .= sprintF($user->lang['SLINGERS_REQUIREMENT'],number_format($quest_slingers_req));
		}
		
		$quest_bowmen_req = $row['quest_bowmen_req'];
		if($quest_bowmen_req > 0)
		{
			$requirements .= sprintF($user->lang['BOWMEN_REQUIREMENT'],number_format($quest_bowmen_req));
		}
		
		$quest_long_bowmen_req = $row['quest_long_bowmen_req'];
		if($quest_long_bowmen_req > 0)
		{
			$requirements .= sprintF($user->lang['LONG_BOWMEN_REQUIREMENT'],number_format($quest_long_bowmen_req));
		}
		
		$quest_crossbowmen_req = $row['quest_crossbowmen_req'];
		if($quest_crossbowmen_req > 0)
		{
			$requirements .= sprintF($user->lang['CROSS_BOWMEN_REQUIREMENT'],number_format($quest_crossbowmen_req));
		}
		
		$quest_light_sword_cavalry_req = $row['quest_light_sword_cavalry_req'];
		if($quest_light_sword_cavalry_req > 0)
		{
			$requirements .= sprintF($user->lang['LIGHT_SWORD_CAVALRY_REQUIREMENT'],number_format($quest_light_sword_cavalry_req));
		}
		
		$quest_heavy_sword_cavalry_req = $row['quest_heavy_sword_cavalry_req'];
		if($quest_heavy_sword_cavalry_req > 0)
		{
			$requirements .= sprintF($user->lang['HEAVY_SWORD_CAVALRY_REQUIREMENT'],number_format($quest_heavy_sword_cavalry_req));
		}
		
		$quest_light_archer_cavalry_req = $row['quest_light_archer_cavalry_req'];
		if($quest_light_archer_cavalry_req > 0)
		{
			$requirements .= sprintF($user->lang['LIGHT_ARCHER_CAVALRY_REQUIREMENT'],number_format($quest_light_archer_cavalry_req));
		}
		
		$quest_heavy_archer_cavalry_req = $row['quest_heavy_archer_cavalry_req'];
		if($quest_heavy_archer_cavalry_req > 0)
		{
			$requirements .= sprintF($user->lang['HEAVY_ARCHER_CAVALRY_REQUIREMENT'],number_format($quest_heavy_archer_cavalry_req));
		}
		
		$quest_paladin_req = $row['quest_paladin_req'];
		if($quest_paladin_req > 0)
		{
			$requirements .= sprintF($user->lang['PALADIN_REQUIREMENT'],number_format($quest_paladin_req));
		}
		
		$quest_dragon_knights_req = $row['quest_dragon_knights_req'];
		if($quest_dragon_knights_req > 0)
		{
			$requirements .= sprintF($user->lang['DRAGON_KNIGHT_REQUIREMENT'],number_format($quest_dragon_knights_req));
		}
		
		$quest_rams_req = $row['quest_rams_req'];
		if($quest_rams_req > 0)
		{
			$requirements .= sprintF($user->lang['RAMS_REQUIREMENT'],number_format($quest_rams_req));
		}
		
		$quest_catapults_req = $row['quest_catapults_req'];
		if($quest_catapults_req > 0)
		{
			$requirements .= sprintF($user->lang['CATAPULTS_REQUIREMENT'],number_format($quest_catapults_req));
		}
		
		$quest_heavy_catapults_req = $row['quest_heavy_catapults_req'];
		if($quest_heavy_catapults_req > 0)
		{
			$requirements .= sprintF($user->lang['HEAVY_CATAPULTS_REQUIREMENT'],number_format($quest_heavy_catapults_req));
		}
		
		$quest_ballistas_req = $row['quest_ballistas_req'];
		if($quest_ballistas_req > 0)
		{
			$requirements .= sprintF($user->lang['BALLISTAS_REQUIREMENT'],number_format($quest_ballistas_req));
		}
		
		$quest_trebuchets_req = $row['quest_trebuchets_req'];
		if($quest_trebuchets_req > 0)
		{
			$requirements .= sprintF($user->lang['TREBUCHETS_REQUIREMENT'],number_format($quest_trebuchets_req));
		}
		
		$quest_chimeras_req = $row['quest_chimeras_req'];
		if($quest_chimeras_req > 0)
		{
			$requirements .= sprintF($user->lang['CHIMERAS_REQUIREMENT'],number_format($quest_chimeras_req));
		}
		
		$quest_hydras_req = $row['quest_hydras_req'];
		if($quest_hydras_req > 0)
		{
			$requirements .= sprintF($user->lang['HYDRAS_REQUIREMENT'],number_format($quest_hydras_req));
		}
		
		$quest_basilisks_req = $row['quest_basilisks_req'];
		if($quest_basilisks_req > 0)
		{
			$requirements .= sprintF($user->lang['BASILISKS_REQUIREMENT'],number_format($quest_basilisks_req));
		}
		
		$quest_wyverns_req = $row['quest_wyverns_req'];
		if($quest_wyverns_req > 0)
		{
			$requirements .= sprintF($user->lang['WYVERNS_REQUIREMENT'],number_format($quest_wyverns_req));
		}
		
		$quest_leviathans_req = $row['quest_leviathans_req'];
		if($quest_leviathans_req > 0)
		{
			$requirements .= sprintF($user->lang['LEVIATHANS_REQUIREMENT'],number_format($quest_leviathans_req));
		}
		
		$quest_dragons_req = $row['quest_dragons_req'];
		if($quest_dragons_req > 0)
		{
			$requirements .= sprintF($user->lang['DRAGONS_REQUIREMENT'],number_format($quest_dragons_req));
		}
		
		$quest_farms_req = $row['quest_farms_req'];
		if($quest_farms_req > 0)
		{
			$requirements .= sprintF($user->lang['FARMS_REQUIREMENT'],number_format($quest_farms_req));
		}
		
		$quest_timber_mills_req = $row['quest_timber_mills_req'];
		if($quest_timber_mills_req > 0)
		{
			$requirements .= sprintF($user->lang['TIMBER_MILLS_REQUIREMENT'],number_format($quest_timber_mills_req));
		}
		
		$quest_iron_mines_req = $row['quest_iron_mines_req'];
		if($quest_iron_mines_req > 0)
		{
			$requirements .= sprintF($user->lang['IRON_MINES_REQUIREMENT'],number_format($quest_iron_mines_req));
		}
		
		$quest_gold_mines_req = $row['quest_gold_mines_req'];
		if($quest_gold_mines_req > 0)
		{
			$requirements .= sprintF($user->lang['GOLD_MINES_REQUIREMENT'],number_format($quest_gold_mines_req));
		}
		
		$quest_towers_req = $row['quest_towers_req'];
		if($quest_towers_req > 0)
		{
			$requirements .= sprintF($user->lang['TOWERS_REQUIREMENT'],number_format($quest_towers_req));
		}
		
		$quest_granaries_req = $row['quest_granaries_req'];
		if($quest_granaries_req > 0)
		{
			$requirements .= sprintF($user->lang['GRANARIES_REQUIREMENT'],number_format($quest_granaries_req));
		}
		
		$quest_woodsheds_req = $row['quest_woodsheds_req'];
		if($quest_woodsheds_req > 0)
		{
			$requirements .= sprintF($user->lang['WOOD_SHEDS_REQUIREMENT'],number_format($quest_woodsheds_req));
		}
		
		$quest_ironpits_req = $row['quest_ironpits_req'];
		if($quest_ironpits_req > 0)
		{
			$requirements .= sprintF($user->lang['IRON_PITS_REQUIREMENT'],number_format($quest_ironpits_req));
		}
		
		$quest_vaults_req = $row['quest_vaults_req'];
		if($quest_vaults_req > 0)
		{
			$requirements .= sprintF($user->lang['VAULTS_REQUIREMENT'],number_format($quest_vaults_req));
		}

		// Check for land requirements
		$quest_land_req = $row['quest_land_req'];
		if($quest_land_req > 0)
		{
			$requirements .= sprintF($user->lang['LAND_REQUIREMENT'],number_format($quest_land_req));
		}

		// Quests will always require stamina
		$quest_stamina_req  = $row['quest_stamina_req']; 
		$requirements .= sprintF($user->lang['STAMINA_REQUIREMENT'],number_format($quest_stamina_req));
	
		// Check for gold requirements
		$quest_gold_req = $row['quest_gold_req'];
		if($quest_gold_req > 0)
		{
			$requirements .= sprintF($user->lang['GOLD_REQUIREMENT'],number_format($quest_gold_req));
		}
	
		// Check for food requirements
		$quest_food_req = $row['quest_food_req'];
		if($quest_food_req > 0)
		{
			$requirements .= sprintF($user->lang['FOOD_REQUIREMENT'],number_format($quest_food_req));
		}
	
		// Check for wood requirements
		$quest_wood_req = $row['quest_wood_req'];
		if($quest_wood_req > 0)
		{
			$requirements .= sprintF($user->lang['WOOD_REQUIREMENT'],number_format($quest_wood_req));
		}
			
		// Check for iron requirements
		$quest_iron_req = $row['quest_iron_req'];
		if($quest_iron_req > 0)
		{
			$requirements .= sprintF($user->lang['IRON_REQUIREMENT'],number_format($quest_iron_req));
		}		
					
		$quest_min_villagers = $row['quest_min_villagers'];
		$quest_max_villagers = $row['quest_max_villagers'];
		if($quest_max_villagers > 0)
		{
			$rewards .= sprintF($user->lang['VILLAGER_QUEST_REWARD'],number_format($quest_min_villagers),number_format($quest_max_villagers));
		}
			
		$quest_min_gold = $row['quest_min_gold'];
		$quest_max_gold = $row['quest_max_gold'];
		if($quest_max_gold > 0)
		{
			$rewards .= sprintF($user->lang['GOLD_QUEST_REWARD'],number_format($quest_min_gold),number_format($quest_max_gold));
		}
			
		$quest_min_food = $row['quest_min_food'];
		$quest_max_food = $row['quest_max_food'];
		if($quest_max_food > 0)
		{
			$rewards .= sprintF($user->lang['FOOD_QUEST_REWARD'],number_format($quest_min_food),number_format($quest_max_food));
		}	
			
		$quest_min_wood = $row['quest_min_wood'];
		$quest_max_wood = $row['quest_max_wood'];
		if($quest_max_wood > 0)
		{
			$rewards .= sprintF($user->lang['WOOD_QUEST_REWARD'],number_format($quest_min_wood),number_format($quest_max_wood));
		}	
			
		$quest_min_iron = $row['quest_min_iron'];
		$quest_max_iron = $row['quest_max_iron'];
		if($quest_max_iron > 0)
		{
			$rewards .= sprintF($user->lang['IRON_QUEST_REWARD'],number_format($quest_min_iron),number_format($quest_max_iron));
		}	
			
		$quest_min_dragoncoins = $row['quest_min_dragoncoins'];
		$quest_max_dragoncoins = $row['quest_max_dragoncoins'];
		if($quest_max_dragoncoins > 0)
		{
			$rewards .= sprintF($user->lang['DRAGONCOIN_QUEST_REWARD'],number_format($quest_min_dragoncoins),number_format($quest_max_dragoncoins));
		}
			
		$quest_min_exp = $row['quest_min_exp'];
		$quest_max_exp = $row['quest_max_exp'];
		if($quest_max_exp > 0)
		{
			$rewards .= sprintF($user->lang['EXP_QUEST_REWARD'],number_format($quest_min_exp),number_format($quest_max_exp));
		}

		$quest_min_soldiers = $row['quest_min_soldiers'];
		$quest_max_soldiers = $row['quest_max_soldiers'];
		if($quest_max_soldiers > 0)
		{
			$rewards .= sprintF($user->lang['SOLDIERS_QUEST_REWARD'],number_format($quest_min_soldiers),number_format($quest_max_soldiers));
		}

		$quest_min_spies = $row['quest_min_spies'];
		$quest_max_spies = $row['quest_max_spies'];
		if($quest_max_spies > 0)
		{
			$rewards .= sprintF($user->lang['SPIES_QUEST_REWARD'],number_format($quest_min_spies),number_format($quest_max_spies));
		}

		$quest_min_macemen = $row['quest_min_macemen'];
		$quest_max_macemen = $row['quest_max_macemen'];
		if($quest_max_macemen > 0)
		{
			$rewards .= sprintF($user->lang['MACEMEN_QUEST_REWARD'],number_format($quest_min_macemen),number_format($quest_max_macemen));
		}

		$quest_min_axemen = $row['quest_min_axemen'];
		$quest_max_axemen = $row['quest_max_axemen'];
		if($quest_max_axemen > 0)
		{
			$rewards .= sprintF($user->lang['AXEMEN_QUEST_REWARD'],number_format($quest_min_axemen),number_format($quest_max_axemen));
		}

		$quest_min_spearmen = $row['quest_min_spearmen'];
		$quest_max_spearmen = $row['quest_max_spearmen'];
		if($quest_max_spearmen > 0)
		{
			$rewards .= sprintF($user->lang['SPEARMEN_QUEST_REWARD'],number_format($quest_min_spearmen),number_format($quest_max_spearmen));
		}

		$quest_min_swordsmen = $row['quest_min_swordsmen'];
		$quest_max_swordsmen = $row['quest_max_swordsmen'];
		if($quest_max_swordsmen > 0)
		{
			$rewards .= sprintF($user->lang['SWORDSMEN_QUEST_REWARD'],number_format($quest_min_swordsmen),number_format($quest_max_swordsmen));
		}

		$quest_min_legionnaires = $row['quest_min_legionnaires'];
		$quest_max_legionnaires = $row['quest_max_legionnaires'];
		if($quest_max_legionnaires > 0)
		{
			$rewards .= sprintF($user->lang['LEGIONNAIRES_QUEST_REWARD'],number_format($quest_min_legionnaires),number_format($quest_max_legionnaires));
		}

		$quest_min_knights = $row['quest_min_knights'];
		$quest_max_knights = $row['quest_max_knights'];
		if($quest_max_knights > 0)
		{
			$rewards .= sprintF($user->lang['KNIGHTS_QUEST_REWARD'],number_format($quest_min_knights),number_format($quest_max_knights));
		}

		$quest_min_slingers = $row['quest_min_slingers'];
		$quest_max_slingers = $row['quest_max_slingers'];
		if($quest_max_slingers > 0)
		{
			$rewards .= sprintF($user->lang['SLINGERS_QUEST_REWARD'],number_format($quest_min_slingers),number_format($quest_max_slingers));
		}

		$quest_min_bowmen = $row['quest_min_bowmen'];
		$quest_max_bowmen = $row['quest_max_bowmen'];
		if($quest_max_bowmen > 0)
		{
			$rewards .= sprintF($user->lang['BOWMEN_QUEST_REWARD'],number_format($quest_min_bowmen),number_format($quest_max_bowmen));
		}

		$quest_min_long_bowmen = $row['quest_min_long_bowmen'];
		$quest_max_long_bowmen = $row['quest_max_long_bowmen'];
		if($quest_max_long_bowmen > 0)
		{
			$rewards .= sprintF($user->lang['LONG_BOWMEN_QUEST_REWARD'],number_format($quest_min_long_bowmen),number_format($quest_max_long_bowmen));
		}

		$quest_min_crossbowmen = $row['quest_min_crossbowmen'];
		$quest_max_crossbowmen = $row['quest_max_crossbowmen'];
		if($quest_max_crossbowmen > 0)
		{
			$rewards .= sprintF($user->lang['CROSS_BOWMEN_QUEST_REWARD'],number_format($quest_min_crossbowmen),number_format($quest_max_crossbowmen));
		}

		$quest_min_light_sword_cavalry = $row['quest_min_light_sword_cavalry'];
		$quest_max_light_sword_cavalry = $row['quest_max_light_sword_cavalry'];
		if($quest_max_light_sword_cavalry > 0)
		{
			$rewards .= sprintF($user->lang['LIGHT_SWORD_CAVALRY_QUEST_REWARD'],number_format($quest_min_light_sword_cavalry),number_format($quest_max_light_sword_cavalry));
		}

		$quest_min_heavy_sword_cavalry = $row['quest_min_heavy_sword_cavalry'];
		$quest_max_heavy_sword_cavalry = $row['quest_max_heavy_sword_cavalry'];
		if($quest_max_heavy_sword_cavalry > 0)
		{
			$rewards .= sprintF($user->lang['HEAVY_SWORD_CAVALRY_QUEST_REWARD'],number_format($quest_min_heavy_sword_cavalry),number_format($quest_max_heavy_sword_cavalry));
		}

		$quest_min_light_archer_cavalry = $row['quest_min_light_archer_cavalry'];
		$quest_max_light_archer_cavalry = $row['quest_max_light_archer_cavalry'];
		if($quest_max_light_archer_cavalry > 0)
		{
			$rewards .= sprintF($user->lang['LIGHT_ARCHER_CAVALRY_QUEST_REWARD'],number_format($quest_min_light_archer_cavalry),number_format($quest_max_light_archer_cavalry));
		}

		$quest_min_heavy_archer_cavalry = $row['quest_min_heavy_archer_cavalry'];
		$quest_max_heavy_archer_cavalry = $row['quest_max_heavy_archer_cavalry'];
		if($quest_max_heavy_archer_cavalry > 0)
		{
			$rewards .= sprintF($user->lang['HEAVY_ARCHER_CAVALRY_QUEST_REWARD'],number_format($quest_min_heavy_archer_cavalry),number_format($quest_max_heavy_archer_cavalry));
		}

		$quest_min_paladin = $row['quest_min_paladin'];
		$quest_max_paladin = $row['quest_max_paladin'];
		if($quest_max_paladin > 0)
		{
			$rewards .= sprintF($user->lang['PALADINS_QUEST_REWARD'],number_format($quest_min_paladin),number_format($quest_max_paladin));
		}

		$quest_min_dragon_knights = $row['quest_min_dragon_knights'];
		$quest_max_dragon_knights = $row['quest_max_dragon_knights'];
		if($quest_max_dragon_knights > 0)
		{
			$rewards .= sprintF($user->lang['DRAGON_KNIGHTS_QUEST_REWARD'],number_format($quest_min_dragon_knights),number_format($quest_max_dragon_knights));
		}

		$quest_min_rams = $row['quest_min_rams'];
		$quest_max_rams = $row['quest_max_rams'];
		if($quest_max_rams > 0)
		{
			$rewards .= sprintF($user->lang['RAMS_QUEST_REWARD'],number_format($quest_min_rams),number_format($quest_max_rams));
		}

		$quest_min_catapults = $row['quest_min_catapults'];
		$quest_max_catapults = $row['quest_max_catapults'];
		if($quest_max_catapults > 0)
		{
			$rewards .= sprintF($user->lang['CATAPULTS_QUEST_REWARD'],number_format($quest_min_catapults),number_format($quest_max_catapults));
		}

		$quest_min_heavy_catapults = $row['quest_min_heavy_catapults'];
		$quest_max_heavy_catapults = $row['quest_max_heavy_catapults'];
		if($quest_max_heavy_catapults > 0)
		{
			$rewards .= sprintF($user->lang['HEAVY_CATAPULTS_QUEST_REWARD'],number_format($quest_min_heavy_catapults),number_format($quest_max_heavy_catapults));
		}

		$quest_min_ballistas = $row['quest_min_ballistas'];
		$quest_max_ballistas = $row['quest_max_ballistas'];
		if($quest_max_ballistas > 0)
		{
			$rewards .= sprintF($user->lang['BALLISTAS_QUEST_REWARD'],number_format($quest_min_ballistas),number_format($quest_max_ballistas));
		}

		$quest_min_trebuchets = $row['quest_min_trebuchets'];
		$quest_max_trebuchets = $row['quest_max_trebuchets'];
		if($quest_max_trebuchets > 0)
		{
			$rewards .= sprintF($user->lang['TREBUCHETS_QUEST_REWARD'],number_format($quest_min_trebuchets),number_format($quest_max_trebuchets));
		}

		$quest_min_chimeras = $row['quest_min_chimeras'];
		$quest_max_chimeras = $row['quest_max_chimeras'];
		if($quest_max_chimeras > 0)
		{
			$rewards .= sprintF($user->lang['CHIMERAS_QUEST_REWARD'],number_format($quest_min_chimeras),number_format($quest_max_chimeras));
		}

		$quest_min_hydras = $row['quest_min_hydras'];
		$quest_max_hydras = $row['quest_max_hydras'];
		if($quest_max_hydras > 0)
		{
			$rewards .= sprintF($user->lang['HYDRAS_QUEST_REWARD'],number_format($quest_min_hydras),number_format($quest_max_hydras));
		}

		$quest_min_basilisks = $row['quest_min_basilisks'];
		$quest_max_basilisks = $row['quest_max_basilisks'];
		if($quest_max_basilisks > 0)
		{
			$rewards .= sprintF($user->lang['BASILISKS_QUEST_REWARD'],number_format($quest_min_basilisks),number_format($quest_max_basilisks));
		}

		$quest_min_wyverns = $row['quest_min_wyverns'];
		$quest_max_wyverns = $row['quest_max_wyverns'];
		if($quest_max_wyverns > 0)
		{
			$rewards .= sprintF($user->lang['WYVERNS_QUEST_REWARD'],number_format($quest_min_wyverns),number_format($quest_max_wyverns));
		}

		$quest_min_leviathans = $row['quest_min_leviathans'];
		$quest_max_leviathans = $row['quest_max_leviathans'];
		if($quest_max_leviathans > 0)
		{
			$rewards .= sprintF($user->lang['LEVIATHANS_QUEST_REWARD'],number_format($quest_min_leviathans),number_format($quest_max_leviathans));
		}

		$quest_min_dragons = $row['quest_min_dragons'];
		$quest_max_dragons = $row['quest_max_dragons'];
		if($quest_max_dragons > 0)
		{
			$rewards .= sprintF($user->lang['DRAGONS_QUEST_REWARD'],number_format($quest_min_dragons),number_format($quest_max_dragons));
		}

		$quest_min_land = $row['quest_min_land'];
		$quest_max_land = $row['quest_max_'];
		if($quest_max_land > 0)
		{
			$rewards .= sprintF($user->lang['LAND_QUEST_REWARD'],number_format($quest_min_land),number_format($quest_max_land));
		}

		$quest_min_farms = $row['quest_min_farms'];
		$quest_max_farms = $row['quest_max_farms'];
		if($quest_max_farms > 0)
		{
			$rewards .= sprintF($user->lang['FARMS_QUEST_REWARD'],number_format($quest_min_farms),number_format($quest_max_farms));
		}

		$quest_min_timber_mills = $row['quest_min_timber_mills'];
		$quest_max_timber_mills = $row['quest_max_timber_mills'];
		if($quest_max_timber_mills > 0)
		{
			$rewards .= sprintF($user->lang['TIMBER_MILLS_QUEST_REWARD'],number_format($quest_min_timber_mills),number_format($quest_max_timber_mills));
		}

		$quest_min_iron_mines = $row['quest_min_iron_mines'];
		$quest_max_iron_mines = $row['quest_max_iron_mines'];
		if($quest_max_iron_mines > 0)
		{
			$rewards .= sprintF($user->lang['IRON_MINES_QUEST_REWARD'],number_format($quest_min_iron_mines),number_format($quest_max_iron_mines));
		}

		$quest_min_gold_mines = $row['quest_min_gold_mines'];
		$quest_max_gold_mines = $row['quest_max_gold_mines'];
		if($quest_max_gold_mines > 0)
		{
			$rewards .= sprintF($user->lang['GOLD_MINES_QUEST_REWARD'],number_format($quest_min_gold_mines),number_format($quest_max_gold_mines));
		}

		$quest_min_towers = $row['quest_min_towers'];
		$quest_max_towers = $row['quest_max_towers'];
		if($quest_max_towers > 0)
		{
			$rewards .= sprintF($user->lang['TOWERS_QUEST_REWARD'],number_format($quest_min_towers),number_format($quest_max_towers));
		}

		$quest_min_granaries = $row['quest_min_granaries'];
		$quest_max_granaries = $row['quest_max_granaries'];
		if($quest_max_granaries > 0)
		{
			$rewards .= sprintF($user->lang['GRANARIES_QUEST_REWARD'],number_format($quest_min_granaries),number_format($quest_max_granaries));
		}

		$quest_min_woodsheds = $row['quest_min_woodsheds'];
		$quest_max_woodsheds = $row['quest_max_woodsheds'];
		if($quest_max_woodsheds > 0)
		{
			$rewards .= sprintF($user->lang['WOOD_SHEDS_QUEST_REWARD'],number_format($quest_min_woodsheds),number_format($quest_max_woodsheds));
		}

		$quest_min_ironpits = $row['quest_min_ironpits'];
		$quest_max_ironpits = $row['quest_max_ironpits'];
		if($quest_max_ironpits > 0)
		{
			$rewards .= sprintF($user->lang['IRON_PITS_QUEST_REWARD'],number_format($quest_min_ironpits),number_format($quest_max_ironpits));
		}

		$quest_min_vaults = $row['quest_min_vaults'];
		$quest_max_vaults = $row['quest_max_vaults'];
		if($quest_max_vaults > 0)
		{
			$rewards .= sprintF($user->lang['VAULTS_QUEST_REWARD'],number_format($quest_min_vaults),number_format($quest_max_vaults));
		}		
		
		if(empty($quest_img_path))
		{
			$quest_img_path = 'images/img.png';
		}
							
		$template->assign_block_vars('questrow', array(
			'NAME'				=>	$quest_name,
			'IMG'				=> 	'<img src="'.$quest_img_path.'" width="100px" height="100px" border="0" >',
			'DESCRIPT'			=>	$quest_descript,
			'FAILURE_CHANCE'	=>	$quest_chance.'%',
			'REQUIREMENTS'		=>	$requirements,
			'REWARDS'			=>	$rewards,
			'ACTION'			=>	'<form method="post"><input type="hidden" name="qid" value="'.$qid.'"><input type="submit" name="cmd" value="'.$user->lang['DO_QUEST'].'" class="button"></form>',		
			)
		);	
	}	
	$db->sql_freeresult($result);


?>